package com.shruijin.wy.thread.cas;

import com.shruijin.wy.thread.anno.SimpleThreadAnno;
import com.shruijin.wy.thread.cas.lock.AtomaticLock;
import com.shruijin.wy.thread.cas.lock.SimpleLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CasThread implements  Runnable {

    Logger LOGGER  = LoggerFactory.getLogger(this.getClass());
    SimpleLock simpleLock = new SimpleLock();
    AtomaticLock atomaticLock = new AtomaticLock();


    @Override
    @SimpleThreadAnno
    public void run() {
        LOGGER.info("{} is running!",Thread.currentThread().getName());
        try {
            synchronized (simpleLock){
                simpleLock.getLock2();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
